package com.theme.passport.controller.theme;

import java.util.Arrays;
import java.util.Map;

import com.theme.common.mvc.view.R;
import com.theme.passport.entity.theme.UserSignInEntity;
import com.theme.passport.service.theme.UserSignInService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.theme.common.mvc.utils.PageUtils;



/**
 * APP用户签到表
 *
 * @author live
 * @email 870459550@qq.com
 * @date 2023-02-21 11:50:56
 */
@RestController
@RequestMapping("theme/user-signin")
public class UserSignInController {
    @Autowired
    private UserSignInService tabUserSignInService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("theme:user-signin:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = tabUserSignInService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("theme:user-signin:info")
    public R info(@PathVariable("id") Long id){
		UserSignInEntity tabUserSignIn = tabUserSignInService.getById(id);

        return R.ok().put("userSignIn", tabUserSignIn);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("theme:user-signin:save")
    public R save(@RequestBody UserSignInEntity tabUserSignIn){
		tabUserSignInService.save(tabUserSignIn);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("theme:user-signin:update")
    public R update(@RequestBody UserSignInEntity tabUserSignIn){
		tabUserSignInService.updateById(tabUserSignIn);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("theme:user-signin:delete")
    public R delete(@RequestBody Long[] ids){
		tabUserSignInService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
